package com.hb.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;



/**
 * @author Buu Huynh
 * @version 1.0
 * @created 30-May-2013 10:09:10 PM
 */
@Entity
public class Job {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	
	/**
	 * job name or job title
	 */
	@Column(length=2000)
	private String name;
	
	@Column
	private Date createdDate;
	
	@Column(length=2000)
	private String description;
	
	/**
	 * total fee will be payed for this job
	 */
	@Column
	private Long fee;
	
	/**
	 * amount payed for each worker
	 */
	@Column
	private Long payment;
	
	@Column
	private Integer workerAmount;
	
	/**
	 * post = true means edit is done and display on job search
	 * post = false means it is being edited
	 */
	@Column
	private Boolean post;
	
	@Column
	private Date postDate;
	
	@Column(length=2000)
	private String proof;
	
	/**
	 * true mean job is done, false is otherwise
	 */
	@Column
	private Boolean status;
	
	
	@Column
	private Date finishDate;
	
	@ManyToOne
	private Category category;
	
	@OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private List<Comment> comment;
	
	@ManyToOne
	private User user;
	
	@OneToMany(fetch=FetchType.LAZY)
	private List<JobStatus> jobStatus;
	
	@OneToMany(fetch=FetchType.LAZY)
	private List<File> file;

	public Job(){

	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getFee() {
		return fee;
	}

	public void setFee(Long fee) {
		this.fee = fee;
	}

	public Boolean getPost() {
		return post;
	}

	public void setPost(Boolean post) {
		this.post = post;
	}

	public Date getPostDate() {
		return postDate;
	}

	public void setPostDate(Date postDate) {
		this.postDate = postDate;
	}

	public String getProof() {
		return proof;
	}

	public void setProof(String proof) {
		this.proof = proof;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getPayment() {
		return payment;
	}

	public void setPayment(Long payment) {
		this.payment = payment;
	}

	public Integer getWorkerAmount() {
		return workerAmount;
	}

	public void setWorkerAmount(Integer workerAmount) {
		this.workerAmount = workerAmount;
	}

	public Boolean getStatus() {
		return status;
	}

	public void setStatus(Boolean status) {
		this.status = status;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public List<Comment> getComment() {
		return comment;
	}

	public void setComment(List<Comment> comment) {
		this.comment = comment;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<JobStatus> getJobStatus() {
		return jobStatus;
	}

	public void setJobStatus(List<JobStatus> jobStatus) {
		this.jobStatus = jobStatus;
	}

	public List<File> getFile() {
		return file;
	}

	public void setFile(List<File> file) {
		this.file = file;
	}

	public void finalize() throws Throwable {

	}

}